package com.lottery.ruok.lottrey.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.lottery.ruok.lottrey.R;
import com.lottery.ruok.lottrey.retrofitModule.response.GetPayTypeResponse;

import java.util.ArrayList;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by ASUS on 2017/11/8.
 */

public class PayListAdapter extends BaseAdapter {
    private Context mContext;
    private ArrayList<GetPayTypeResponse> mGetPayTypeResponses;
    public PayListAdapter(Context context, ArrayList<GetPayTypeResponse> getPayTypeResponses) {
        mContext = context;
        mGetPayTypeResponses = getPayTypeResponses;
    }

    @Override
    public int getCount() {
        if (mGetPayTypeResponses == null) {
            return 0;
        }
        return mGetPayTypeResponses.size();
    }

    @Override
    public long getItemId(int i) {
        return 0;
    }

    @Override
    public Object getItem(int i) {
        return null;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder;
        if (view != null) {
            holder = (ViewHolder) view.getTag();
        } else {
            view = LayoutInflater.from(mContext).inflate(R.layout.charge_child_item, viewGroup, false);
            holder = new ViewHolder(view);
            view.setTag(holder);
        }

//        holder.name.setText(mGetPayTypeResponses.get(i));
////            holder.tip.setText(getPayListResponses.get(i).getDescr());
//        GlideHelper.loadImage(mContext, mGetPayTypeResponses.get(i).getLogo(), holder.logo);

        return view;
    }

    static class ViewHolder {
        @BindView(R.id.logo)
        ImageView logo;
        @BindView(R.id.name)
        TextView name;

        public ViewHolder(View view) {
            ButterKnife.bind(this, view);
        }
    }
}
